<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>姓名案例-methods实现</title>
    <script src="../commonjs/vue.js"></script>
</head>
<body>
    <div id="root">
        姓:<input type="text" v-model="person.firstName"><br><br>
        名:<input type="text" v-model="person.lastName"><br><br>
        全名:<span>{{fullName()}}</span>
    </div>
    <script>
        Vue.config.productionTip = false;//关闭开发提示
        new Vue({
            el:'#root',
            data:{
                school:{name:'武威职业学院'},
                person:{
                    firstName:'',
                    lastName:''
                }
            },
            methods:{
                fullName(){
                    return this.person.firstName.slice(0,3) + "-" + this.person.lastName
                }
            }
        })
    </script>
</body>
</html>